<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<c:set var="cp" value="<%=request.getContextPath() %>"></c:set>
<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>my-admin1.0</title>
	<meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,ch0rome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="css/font.css">
	<link rel="stylesheet" href="lib/layui/css/layui.css">
    <script src="lib/layui/layui.js" charset="utf-8"></script>
    <style type="text/css">
    .layui-table-cell{
height:auto !important;
}
    </style>
</head>
<body class="child-body" style="padding: 10px 15px 15px 15px">     
<div class="child-nav">
    <span class="layui-breadcrumb" style="visibility: visible;">
         <a>我的工作台</a><span lay-separator="">/</span>
         <a><cite>窗口设置</cite></a>
    </span>
</div>
<hr class="layui-bg-gray">
	<div class="layui-btn-group demoTable">
        <button class="layui-btn layui-btn-sm" data-type="add"><i class="layui-icon"></i>添加窗口</button>
     </div>
    <table class="layui-table" lay-filter="test"  id="test" ></table>  
	<script type="text/html" id="barDemo">
 	 <a class="layui-btn layui-btn-sm" lay-event="edit">关联</a>
	</script>
	<script type="text/html" id="titleTpl">
  {{#  if(d[6]==1){ }}
			<video width="100" height="100" controls>
        	<source src="${cp}/upload/{{d[5]}}" type="video/mp4">
        	<object data="${cp}/upload/{{d[5]}}" width="100" height="100">
            <embed width="100" height="100" src="movie.swf">
        	</object></video>
  {{#  } else { }}
	 {{#  if(d[7]==null){ }}
	 {{#  } else { }}
   <a href="wzDetail.htm?id={{d[2]}}">{{d[7]}}</a>
	 {{#  } }}
  {{#  } }}
	</script>
<script>
layui.use(['table','form'], function(){
	  var table = layui.table;	
	    table.render({
	    elem: '#test',
	    limit: 5,
	    limits:[5,10,20],
	    url:'${cp}/listJson.htm',
	    cols: [[
	       {field:'1', width:380,title: '窗口ID', sort: true}
	      ,{field:'2',width:380,title: '文件ID/文章ID'}
	      ,{field:'5',title: '视频/音频/文章',templet: '#titleTpl'}
	      ,{title:'操作', toolbar: '#barDemo', width:150}
	    ]]
	    ,page: true
	  });
	    
	  //监听行工具事件
	    table.on('tool(test)', function(obj){
	      var data = obj.data;
	      parent.layer.open({
			   type: 1,
			   title: '<h3>修改窗口</h3>',
			   shadeClose: true,
			   shade: 0.5,
			   area: ['500px', '300px'],
			   content: '<form class="layui-form" action=""  lay-fitler="sys-user-edit" lay-fitler="sys-user-edit"><div class="layui-form-item" style="padding-top:25px"><div class="layui-inline">'+
			                  '<label class="layui-form-label">窗口ID：</label>'+
			                  '<div class="layui-input-block" style="width: 300px;"><input type="text" style="border:0"  readonly="readonly" value="'+data[1]+'" class="layui-input"></div></div></div>'+
			                  '<div class="layui-form-item"><div class="layui-inline">'+
			                  '<label class="layui-form-label">文件/视频ID：</label>'+
			                  '<div class="layui-input-block" style="width: 300px;"><input type="text" onkeyup="value=zhzs(this.value)" id="sid" name="sid"  value="'+data[2]+'" required  lay-verify="required"  placeholder="请输入id" autocomplete="off" class="layui-input" maxlength="9"></div></div></div>'+
			                  '<div class="layui-form-item"><div class="layui-input-block"><button class="layui-btn"  type="button" onclick=xiugai('+data[0]+')>修改</button><button type="reset" class="layui-btn layui-btn-primary">重置</button></div></div></form>',	    			 
		   });
	    
	    });
	  	  
	    var $ = layui.$, active = {
	    	   add: function(){ 
	    		   parent.layer.open({
	    			   type: 1,
	    			   title: '<h3>新增窗口</h3>',
	    			   shadeClose: true,
	    			   shade: 0.5,
	    			   area: ['500px', '300px'],
	    			   content: '<form class="layui-form" action=""  lay-fitler="sys-user-edit" lay-fitler="sys-user-edit"><div class="layui-form-item" style="padding-top:25px"><div class="layui-inline">'+
	    			                  '<label class="layui-form-label">窗口ID：</label>'+
	    			                  '<div class="layui-input-block" style="width: 300px;"><input type="text" id="name" name="name" required lay-verify="required" autocomplete="off" placeholder="请输入窗口ID" class="layui-input" maxlength="30"></div></div></div>'+
	    			                  '<div class="layui-form-item"><div class="layui-inline">'+
	    			                  '<label class="layui-form-label">文件/视频ID：</label>'+
	    			                  '<div class="layui-input-block" style="width: 300px;"><input type="text" onkeyup="value=zhzs(this.value)" id="sid" name="sid" required  lay-verify="required"  placeholder="请输入ID" autocomplete="off" class="layui-input" maxlength="9"></div></div></div>'+
	    			                  '<div class="layui-form-item"><div class="layui-input-block"><button class="layui-btn"  type="button" onclick="tijiao()">提交</button><button type="reset" class="layui-btn layui-btn-primary">重置</button></div></div></form>',	    			 
	    		   });
	    	    }
	    	  };
	    	  
	    	  $('.demoTable .layui-btn').on('click', function(){
	    	    var type = $(this).data('type');
	    	    active[type] ? active[type].call(this) : '';
	    	  });	 	
	    	  
	    	   
	});	
</script>
</body>
</html>